$(function() {
	var searchUrl = window.location.href;
	var ind = searchUrl.split("=")[1]; //截取 url中的“=”,获得“=”后面的参数
	// console.log(ind)
	$('.journalismBox .nav_intro li').removeClass('pitch')
	$('.journalismBox .PC_nav_intro li').eq(ind).addClass('pitch')
	$('.journalismBox .YD_nav_intro li').eq(ind).addClass('pitch')
	
	// 获取新闻分类
	if (ind == 0) {
		$(".synopsis").empty();
		introduction();
	} else if(ind == 1){
		$(".synopsis").empty();
		businessAdvantage()
	}else{
		$(".synopsis").empty();
		businessGlory()
	}
})



// 关于我们
$('.journalismBox .nav_intro li').click(function(){
	$(this).siblings().removeClass('pitch')
	$(this).addClass('pitch')
	var ind = $(this).index()
	if (ind == 0) {
		$(".synopsis").empty();
		introduction();
	} else if(ind == 1){
		$(".synopsis").empty();
		businessAdvantage()
	}else{
		$(".synopsis").empty();
		businessGlory()
	}
	
	// $('.journalismList .synopsis li').css('display','none')
	// $('.journalismList .synopsis li').eq($(this).index()).css('display','block')
})


//获取公司简介
function introduction() {
	$.ajax({
		type: 'GET',
		url: urlBox+'/api/introduction/',
		dataType: 'json',
		success: function(data) {
			var case_list = data.introduction_info;
			// console.log(case_list)
			var divs = $('<li class="company">'
							+
							case_list.article
							+
						'</li>')
			$(".synopsis").append(divs);
		}
	})
}

//获取公司优势
function businessAdvantage() {
	$.ajax({
		type: 'GET',
		url: urlBox+'/api/businessAdvantage/',
		dataType: 'json',
		success: function(data) {
			var case_list = data.advantage_info;
			// console.log(case_list)
			var divs = $('<li class="company">'
							+
							case_list.article
							+
						'</li>')
			$(".synopsis").append(divs);
		}
	})
}
//专利容易
function businessGlory() {
	$.ajax({
		type: 'GET',
		url: urlBox+'/api/businessGlory/',
		dataType: 'json',
		success: function(data) {
			var case_list = data.glory_list;
			// console.log(case_list)
			for (var i = 0; i < case_list.length; i++) {
				var divs = $('<li class="patent">'+
							'<div>'+
								'<div>'+
									case_list[i].title
								+'</div>'+
							'</div>'+
						'</li>')
				$(".synopsis").append(divs);
			}
			
		}
	})
}


